home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / video / zapem-0.000 / zapem-0 / zapem / asmblock.cc < prev    next >
C/C++ Source or Header  |  1995-04-02  |  2KB  |  117 lines

  1. /*    Copyright Alex Hornby 1994/1995. All rights reserved.
  2.      See file README for details
  3. */
  4.  
  5. #include "btypes.h"
  6. #include "screendefs.h"
  7.  
  8. void
  9. cls( void *video, byte col)
  10. {
  11.     for(int i=0; i<SCREENWIDTH*SCREENHEIGHT; i++)
  12.     {
  13.         *(((byte*)video)++)=col;
  14.     }
  15. }
  16.  
  17. void 
  18. cutblock( void* source, void* dest, unsigned int width, unsigned int height)
  19. {
  20.     uint32 widthl=width/4;
  21.     uint32 adj=(SCREENWIDTH-width)/4;
  22.     
  23.     for(int y=0; y<height; y++)
  24.     {
  25.         for(int x=0; x<widthl ;x++)
  26.             *(((uint32*)dest)++)=*(((uint32*)source)++);
  27.         (uint32*)source+=adj;
  28.     }
  29. }
  30.  
  31. void 
  32. cutblocknew( void* source, void* dest, unsigned int swidth, unsigned int width, unsigned int height)
  33. {
  34.     uint32 widthl=width/4;
  35.     uint32 adj=(swidth-width)/4;
  36.     
  37.     for(int y=0; y<height; y++)
  38.     {
  39.         for(int x=0; x<widthl ;x++)
  40.             *(((uint32*)dest)++)=*(((uint32*)source)++);
  41.         (uint32*)source+=adj;
  42.     }
  43. }
  44.  
  45. void 
  46. pasteblock( void* source, void* dest, unsigned int width, unsigned int height)
  47. {
  48.     uint32 widthl=width/4;
  49.     uint32 adj=(SCREENWIDTH-width)/4;
  50.     
  51.     for(int y=0; y<height; y++)
  52.     {
  53.         for(int x=0; x<widthl ;x++)
  54.             *(((uint32*)dest)++)=*(((uint32*)source)++);
  55.         (uint32*)dest+=adj;
  56.     }
  57. }
  58.  
  59. void 
  60. andpasteblock( void* source, void* dest, unsigned int width, unsigned int height)
  61. {
  62.     uint32 widthl=width/4;
  63.     uint32 adj=(SCREENWIDTH-width)/4;
  64.     
  65.     for(int y=0; y<height; y++)
  66.     {
  67.         for(int x=0; x<widthl ;x++)
  68.             *(((uint32*)dest)++)&=*(((uint32*)source)++);
  69.         (uint32*)dest+=adj;
  70.     }
  71. }
  72.  
  73. void 
  74. xorpasteblock( void* source, void* dest, unsigned int width, unsigned int height)
  75. {
  76.     uint32 widthl=width/4;
  77.     uint32 adj=(SCREENWIDTH-width)/4;
  78.  
  79.     for(int y=0; y<height; y++)
  80.     {
  81.         for(int x=0; x<widthl ;x++)
  82.             *(((uint32*)dest)++)^=*(((uint32*)source)++);
  83.         (uint32*)dest+=adj;
  84.     }
  85. }
  86.  
  87. void 
  88. orpasteblock( void* source, void* dest, unsigned int width, unsigned int height)
  89. {
  90.     uint32 widthl=width/4;
  91.     uint32 adj=(SCREENWIDTH-width)/4;
  92.  
  93.     for(int y=0; y<height; y++)
  94.     {
  95.         for(int x=0; x<widthl ;x++)
  96.             *(((uint32*)dest)++)|=*(((uint32*)source)++);
  97.         (uint32*)dest+=adj;
  98.     }
  99. }
  100.  
  101. void 
  102. transpasteblock( void* source, void *mask, void* dest, unsigned int width, unsigned int height)
  103. {
  104.     uint32 widthl=width/4;
  105.     uint32 adj=(SCREENWIDTH-width)/4;
  106.  
  107.     for(int y=0; y<height; y++)
  108.     {
  109.         for(int x=0; x<widthl ;x++)
  110.         {
  111.             *(((uint32*)dest))&=*(((uint32*)mask)++);
  112.             *(((uint32*)dest)++)^=*(((uint32*)source)++);
  113.         }
  114.         (uint32*)dest+=adj;
  115.     }
  116. }
  117.